/*=============================================================================
*
*   Copyright (C) 2020 All rights reserved.
*
*   Filename:		types.hpp
*
*   Author: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Date:  2020-01-17 16:53
*
*   Last Editors: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Last modified:	2020-07-25 03:19
*
*   Description:
*
=============================================================================*/
#if !defined(COMMON_TYPES_H)
#define COMMON_TYPES_H

#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weverything"
#elif defined(_MSC_VER)
#pragma warning(push, 0)
#endif

#include <Eigen/Dense>
#include <Eigen/Eigenvalues>
#include <Eigen/Sparse>

#ifdef __clang__
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif

#include <cfloat>
#include <tuple>
#include <unordered_map>

/* using _real = double; */
using _real = float;

/*Eigen related{{{*/

using Matrix2R = Eigen::Matrix<_real, 2, 2>;
using Matrix3R = Eigen::Matrix<_real, 3, 3>;
using Matrix4R = Eigen::Matrix<_real, 4, 4>;
using MatrixXR = Eigen::Matrix<_real, -1, -1>;

using Matrix2XR = Eigen::Matrix<_real, 2, -1>;
using Matrix3XR = Eigen::Matrix<_real, 3, -1>;
using Matrix4XR = Eigen::Matrix<_real, 4, -1>;

using Vector2R = Eigen::Matrix<_real, 2, 1>;
using Vector3R = Eigen::Matrix<_real, 3, 1>;
using Vector4R = Eigen::Matrix<_real, 4, 1>;
using VectorXR = Eigen::Matrix<_real, -1, 1>;

using RowVector2R = Eigen::Matrix<_real, 1, 2>;
using RowVector3R = Eigen::Matrix<_real, 1, 3>;
using RowVector4R = Eigen::Matrix<_real, 1, 4>;
using RowVectorXR = Eigen::Matrix<_real, 1, -1>;

using ArrayXXR = Eigen::Array<_real, -1, -1>;

using SpMat = Eigen::SparseMatrix<_real>;
/* using SpTri = Eigen::Triplet<_real>; */
/*}}}*/
namespace geoxfem {
/* self custom types{{{*/

template <typename _keyType, typename _valueType>
using GEOXFEM_Map = std::unordered_map<_keyType, _valueType>;
/* using GEOXFEM_Records = std::unordered_map<std::string, _real>; */
using GEOXFEM_Hash = std::string;
/*}}}*/
}  // namespace geoxfem

/* const value related{{{*/

constexpr _real rad_to_deg          = static_cast<_real>(180. / M_PI);
constexpr _real deg_to_rad          = static_cast<_real>(M_PI / 180.);
constexpr _real r_5                 = 0.5;
constexpr _real r_25                = 0.25;
constexpr _real r0                  = 0;
constexpr _real r1                  = 1;
constexpr _real r2                  = 2;
constexpr _real GEOXFEM_LARGE_FLOAT = FLT_MAX;
constexpr _real GEOXFEM_SMALL_FLOAT = FLT_MIN;
constexpr _real GEOXFEM_MATH_TOL    = static_cast<_real>(1e-4);
constexpr int   GEOXFEM_NOT_GIVEN   = INT32_MAX;
/*}}}*/

#endif  /// COMMON_TYPES_H
